package com.amigo.online.message.controller;


import com.amigo.online.common.core.response.Result;
import com.amigo.online.message.service.BlacklistService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 黑名单
 */
@RestController
@RequestMapping("/blacklist")
public class BlacklistController {
    @Autowired
    BlacklistService blacklistService;

    @ApiOperation(value = "拉黑" ,  notes="拉黑")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "用户token",paramType = "header"),
            @ApiImplicitParam(name = "userId", value = "被拉黑用户ID", paramType= "query")
    })
    @GetMapping("/addBlacklist")
    public Result addBlacklist(@RequestHeader String token, String userId){
        return blacklistService.addBlacklist(token, userId);
    }



    @ApiOperation(value = "取消拉黑" ,  notes="取消拉黑")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "用户token",paramType = "header"),
            @ApiImplicitParam(name = "userId", value = "被拉黑用户ID", paramType = "body")
    })
    @GetMapping("/deleteBlacklist")
    public Result deleteBlacklist(@RequestHeader String token, String userId){
        return blacklistService.deleteBlacklist(token, userId);
    }



    @ApiOperation(value = "是否拉黑" ,  notes="是否拉黑")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "用户token",paramType = "header"),
            @ApiImplicitParam(name = "userId", value = "被拉黑用户ID", paramType = "body")
    })
    @GetMapping("/selectBlacklist")
    public Result<Boolean> selectBlacklist(@RequestHeader String token, String userId){
        return blacklistService.selectBlacklist(token, userId);
    }


}
